//
//  FirstView.m
//  MMLOOK
//
//  Created by dllo on 15/9/28.
//  Copyright © 2015年 武俊娥. All rights reserved.
//

#import "FirstView.h"
#import "UIImageView+WebCache.h"
#import "WedModel.h"

@interface FirstView ()

@property(nonatomic, retain)UIImageView *imageView;
@property(nonatomic, retain)UILabel *infoLabel;
@property(nonatomic, retain)UILabel *priceLabel;

@end

@implementation FirstView


-(void)dealloc
{
    [_imageView release];
    [_infoLabel release];
    [_priceLabel release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, frame.size.width - 20, frame.size.width - 20)];
        [self addSubview:self.imageView];
        [_imageView release];
        
        self.infoLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10 + frame.size.width - 20, frame.size.width - 20, 50)];
        self.infoLabel.textColor = [UIColor grayColor];
        self.infoLabel.numberOfLines = 2;
        [self addSubview:self.infoLabel];
        [_infoLabel release];
        
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 10 + frame.size.width - 20 + 50, frame.size.width - 20, 30)];
        self.priceLabel.textColor = [UIColor redColor];
        self.priceLabel.font = [UIFont systemFontOfSize:20];
        self.priceLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.priceLabel];
        
        
    }
    
    return self;
}

-(void)sendValue:(WedModel *)model
{
  
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.photo_path] placeholderImage:[UIImage imageNamed:@"home.jpg"]];
    
    self.infoLabel.text = model.introduce;
    
    self.priceLabel.text = [NSString stringWithFormat:@"￥%@", [model.price stringValue]];
    
}



@end
